Next | Prev | Up | Top | Contents | Index

Modifying the Hosts Database

Before you modify the hosts database, you should have a list of station names and valid Internet addresses of all stations in your network, as discussed in "Allocating IP Addresses". If the network has routers (stations with multiple network interfaces), there must be a valid Internet address and name for each interface. See "Internet Protocol Addresses" for a description of IP addresses.

The hosts file is the hostname database. It contains information regarding known stations, from the perspective of the local station. This example assumes that you are not using NIS or BIND. If you are using NIS, refer to the NIS Administration Guide for more information. If you are using BIND, refer to Chapter 6, "BIND Name Server," for more information.

The /etc/hosts database is an ASCII file that you can modify with any text editor. The file contains lines of text that specify a station's address, its "official" name, and any aliases. The "official" name should be the fully qualified domain name. The address and name(s) are separated by blanks, tabs, or both. Comments begin with a pound sign (#) and continue to the end of the line.

An /etc/hosts database is shown in this sample /etc/hosts file:

# This is a comment 
127.0.0.1   localhost
119.0.3.20  tuna.salad.com tuna  # tuna is an alias
119.0.3.21  chicken.salad.com  salad
119.0.3.22  walrus.salad.com  walrus
Each IRIS system must have a copy of /etc/hosts that contains entries for localhost and all of its network interfaces. As shipped, the /etc/hosts database contains two entries. The first entry is a name you can use to test the local network software:

127.0.0.1 localhost

When you reference localhost, the message is looped back internally; it is never transmitted across the network.

Caution: Many important programs depend on the localhost entry--do NOT remove or modify it. If the master copy of /etc/hosts is not maintained on an IRIS station or if you are using BIND or NIS, make sure that the host database contains the localhost entry. To enable the IRIS system to access the network, add an entry containing the newly assigned IP address and the name in /etc/sys_id. The entry must contain the sys_id name, either as the official hostname or as an alias.

Using the example /etc/hosts file above, the /etc/sys_id file for the host walrus should contain either "walrus" or "walrus.salad.com".

If you change the IRIS system's name in /etc/sys_id, make sure to update the entry in /etc/hosts; otherwise the network software will not initialize properly. If the following message appears during station startup, then the /etc/hosts and /etc/sys_id files are inconsistent and must be fixed:

*** Can't find hostname's Internet address in /etc/hosts

If your IRIS system is a gateway, each network interface must be assigned an Internet address and have an entry in /etc/hosts, as described in "Setting Up a Router".

It is important that each station have a consistent version of the host database. The proper method for maintaining the consistency depends on the size of your network and whether the network is connected to the Internet. You can use the rcp or rdist programs by means of a cron job to ensure that the hosts files stay in sync.

Edit the /etc/hosts file and add the hostnames and Internet addresses for all stations on your network. Each station on the network must have all station names in the local /etc/hosts file. If you have a large /etc/hosts file, the easiest way to install it on a new system is to set up a minimal hosts file with entries for the new system and for another system that has an authoritative copy of the hosts file. This allows you to get the new system on the net and copy the more complete hosts file from the other system (using rcp or ftp). Another option is to transfer the hosts file on tape or disk.


Next | Prev | Up | Top | Contents | Index